<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    
    <title>jouyouyun&#39;s blog</title>
    <meta name="viewport" content="width=device-width,minimum-scale=1">
    <meta name="description" content="jouyouyun&#39;s blog.">
    <meta name="generator" content="Hugo 0.105.0">
    
    
    
    
      <meta name="robots" content="noindex, nofollow">
    

    
<link rel="stylesheet" href="/ananke/css/main.min.css" >



    
    
    
      

    

    
    
      <link href="/post/index.xml" rel="alternate" type="application/rss+xml" title="jouyouyun&#39;s blog" />
      <link href="/post/index.xml" rel="feed" type="application/rss+xml" title="jouyouyun&#39;s blog" />
      
    
    
    <meta property="og:title" content="Posts" />
<meta property="og:description" content="jouyouyun&#39;s blog." />
<meta property="og:type" content="website" />
<meta property="og:url" content="https://jouyouyun.github.io/post/" />

<meta itemprop="name" content="Posts">
<meta itemprop="description" content="jouyouyun&#39;s blog."><meta name="twitter:card" content="summary"/>
<meta name="twitter:title" content="Posts"/>
<meta name="twitter:description" content="jouyouyun&#39;s blog."/>

	
  </head>

  <body class="ma0 avenir bg-near-white">

    

  <header>
    <div class="pb3-m pb6-l bg-black">
      <nav class="pv3 ph3 ph4-ns" role="navigation">
  <div class="flex-l justify-between items-center center">
    <a href="/" class="f3 fw2 hover-white no-underline white-90 dib">
      
        jouyouyun&#39;s blog
      
    </a>
    <div class="flex-l items-center">
      

      
        <ul class="pl0 mr3">
          
          <li class="list f5 f4-ns fw4 dib pr3">
            <a class="hover-white no-underline white-90" href="/post/" title="Archives 页">
              Archives
            </a>
          </li>
          
          <li class="list f5 f4-ns fw4 dib pr3">
            <a class="hover-white no-underline white-90" href="/tags/" title="Tags 页">
              Tags
            </a>
          </li>
          
          <li class="list f5 f4-ns fw4 dib pr3">
            <a class="hover-white no-underline white-90" href="/categories/" title="Categories 页">
              Categories
            </a>
          </li>
          
        </ul>
      
      
<div class="ananke-socials">
  
    <a href="https://github.com/jouyouyun" target="_blank" class="github ananke-social-link link-transition stackoverflow link dib z-999 pt3 pt0-l mr1" title="GitHub link" rel="noopener" aria-label="follow on GitHub——Opens in a new window">
      
        <span class="icon"><svg style="enable-background:new 0 0 512 512;" version="1.1" viewBox="0 0 512 512"  xml:space="preserve" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" >
  <path d="M256,32C132.3,32,32,134.8,32,261.7c0,101.5,64.2,187.5,153.2,217.9c11.2,2.1,15.3-5,15.3-11.1   c0-5.5-0.2-19.9-0.3-39.1c-62.3,13.9-75.5-30.8-75.5-30.8c-10.2-26.5-24.9-33.6-24.9-33.6c-20.3-14.3,1.5-14,1.5-14   c22.5,1.6,34.3,23.7,34.3,23.7c20,35.1,52.4,25,65.2,19.1c2-14.8,7.8-25,14.2-30.7c-49.7-5.8-102-25.5-102-113.5   c0-25.1,8.7-45.6,23-61.6c-2.3-5.8-10-29.2,2.2-60.8c0,0,18.8-6.2,61.6,23.5c17.9-5.1,37-7.6,56.1-7.7c19,0.1,38.2,2.6,56.1,7.7   c42.8-29.7,61.5-23.5,61.5-23.5c12.2,31.6,4.5,55,2.2,60.8c14.3,16.1,23,36.6,23,61.6c0,88.2-52.4,107.6-102.3,113.3   c8,7.1,15.2,21.1,15.2,42.5c0,30.7-0.3,55.5-0.3,63c0,6.1,4,13.3,15.4,11C415.9,449.1,480,363.1,480,261.7   C480,134.8,379.7,32,256,32z"/>
</svg>
</span>
      
<span class="new-window"><svg  height="8px"  style="enable-background:new 0 0 1000 1000;" version="1.1" viewBox="0 0 1000 1000"  xml:space="preserve" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" >
<path d="M598 128h298v298h-86v-152l-418 418-60-60 418-418h-152v-86zM810 810v-298h86v298c0 46-40 86-86 86h-596c-48 0-86-40-86-86v-596c0-46 38-86 86-86h298v86h-298v596h596z" style="fill-rule:evenodd;clip-rule:evenodd;"/>
</svg>
</span></a>
  
</div>

    </div>
  </div>
</nav>

      <div class="tc-l pv3 ph3 ph4-ns">
        <h1 class="f2 f-subheadline-l fw2 light-silver mb0 lh-title">
          Posts
        </h1>
        
      </div>
    </div>
  </header>


    <main class="pb7" role="main">
      

  <article class="pa3 pa4-ns nested-copy-line-height">
    <section class="cf ph3 ph5-l pv3 pv4-l f4 tc-l center measure-wide lh-copy mid-gray">
      
    </section>
    <aside class="flex-ns flex-wrap justify-around mt5">
      
        <div class="relative w-100 w-30-l mb4 bg-white">
            <div class="mb3 pa4 mid-gray overflow-hidden">
    
      <div class="f6">
        四月 25, 2016
      </div>
    
    <h1 class="f3 near-black">
      <a href="/post/enable-coredump/" class="link black dim">
        Enable Coredump
      </a>
    </h1>
    <div class="nested-links f5 lh-copy nested-copy-line-height">
      <h2 id="简介">简介</h2>
<p>当一个程序崩溃时会产生一个 <code>core</code> 文件, 里面记录了这个程序崩溃的原因, 这些信息对于开发者是很有用的.</p>
<p>但是 <code>core dumps</code> 在大多数 <code>linux</code> 上是被禁用的, 下面就介绍下如何开启这个功能.</p>
<h2 id="开启">开启</h2>
<p>可以通过 <code>ulimit -c</code> 的输出知道此功能是否开启, 输出为 <code>0</code> 表示禁用, 否则为开启.</p>
<h3 id="临时开启">临时开启</h3>
<p>通过 <code>ulimit -c unlimited</code> 命令来开启 <code>coredump</code> 功能, 它会程序运行的当前目录生成一个 <code>core</code> 文件, 新的 <code>core</code> 会覆盖旧的.</p>
<p>通过可以修改 <code>/proc/sys/kernel/core_uses_pid</code> 文件内容为 <code>1</code> 来生成以 <code>pid</code> 作为扩展名的 <code>core</code> 文件.</p>
<p>通过修改 <code>/proc/sys/kernel/core_pattern</code> 可以修改 <code>core</code> 文件的保存位置和格式. 如把内容改为 <code>/tmp/core-%e-%p-%t</code>, 就表示把 <code>core</code> 文件保存到 <code>/tmp</code> 目录下, 文件名的格式为 <code>core-命令名-pid-时间戳</code> .</p>
    </div>
  </div>

        </div>
      
        <div class="relative w-100 w-30-l mb4 bg-white">
            <div class="mb3 pa4 mid-gray overflow-hidden">
    
      <div class="f6">
        四月 22, 2016
      </div>
    
    <h1 class="f3 near-black">
      <a href="/post/auto-hidden-cursor/" class="link black dim">
        Auto Hidden Cursor
      </a>
    </h1>
    <div class="nested-links f5 lh-copy nested-copy-line-height">
      <p>最近需要做一个隐藏光标的功能, 在这里将了解到的知识总结一下.</p>
<h2 id="原理">原理</h2>
<p>隐藏光标的原理就是把光标设置为一个 <code>x11 null cursor</code>, 不需要隐藏时再将它设为 <code>x11 left_ptr cursor</code>.</p>
    </div>
  </div>

        </div>
      
        <div class="relative w-100 w-30-l mb4 bg-white">
            <div class="mb3 pa4 mid-gray overflow-hidden">
    
      <div class="f6">
        二月 3, 2016
      </div>
    
    <h1 class="f3 near-black">
      <a href="/post/debug-summary/" class="link black dim">
        Debug 小结
      </a>
    </h1>
    <div class="nested-links f5 lh-copy nested-copy-line-height">
      <p>调试 <code>bug</code> 的时候要有耐心, 要不断测试, 直到找到问题原因.</p>
<h2 id="基本思路">基本思路</h2>
<h3 id="确定-bug-出现的方式">确定 <code>bug</code> 出现的方式</h3>
<ul>
<li>一定要找到稳定重现的方式, 这样才能方便下面的调试</li>
<li>如果找不到稳定重现的方法就只能根据上次出现的情形, 去查看相关的代码, 猜测可能出问题的地方, 然后针对那一块进行调试, 直到找到稳定重现方式</li>
</ul>
<h3 id="定位出问题的代码">定位出问题的代码</h3>
<ul>
<li>再找到稳定重现方式后, 开始定位出问题的函数, 然后加入调试信息, 不断尝试, 直到找到有问题的代码</li>
<li>找到有问题的代码后, 如果发现是第三方库里的函数,可以打印出每次调用的输入输出参数, 看看是否有迹可循, 可以单独写个小程序, 传入问题的参数, 进行不断测试, 来确定第三方库有没有问题</li>
<li>如果自己程序的代码, 就一行一行的慢慢测试, 确定问题的原因, 原因找到了就可以开始思考解决方法了</li>
</ul>
    </div>
  </div>

        </div>
      
        <div class="relative w-100 w-30-l mb4 bg-white">
            <div class="mb3 pa4 mid-gray overflow-hidden">
    
      <div class="f6">
        二月 3, 2016
      </div>
    
    <h1 class="f3 near-black">
      <a href="/post/xsetwacom-options/" class="link black dim">
        xsetwacom 选项说明
      </a>
    </h1>
    <div class="nested-links f5 lh-copy nested-copy-line-height">
      <p><code>xsetwacom</code> 是一个设置数位板的命令行工具, 在 <code>Debian/Ubuntu/deepin</code> 上可以通过安装 <code>xserver-xorg-input-wacom</code> 来获取它.</p>
<p>可以通过 <code>man xsetwacom</code> 看到它的帮助文档, 下面就简单说明下它的部份选项:</p>
<hr>
<h2 id="options">Options</h2>
    </div>
  </div>

        </div>
      
        <div class="relative w-100 w-30-l mb4 bg-white">
            <div class="mb3 pa4 mid-gray overflow-hidden">
    
      <div class="f6">
        七月 20, 2014
      </div>
    
    <h1 class="f3 near-black">
      <a href="/post/go-tcp-socket-example/" class="link black dim">
        Go 笔记: 简单的 TCP Socket 示例
      </a>
    </h1>
    <div class="nested-links f5 lh-copy nested-copy-line-height">
      <p>一个简单的 <code>TCP Socket</code> 的示例，使用 <code>gob</code> 处理传输的数据。</p>
<h2 id="server-dot-go"><code>server.go</code></h2>
    </div>
  </div>

        </div>
      
        <div class="relative w-100 w-30-l mb4 bg-white">
            <div class="mb3 pa4 mid-gray overflow-hidden">
    
      <div class="f6">
        七月 7, 2014
      </div>
    
    <h1 class="f3 near-black">
      <a href="/post/go-gob-rw-file/" class="link black dim">
        Go 笔记: Gob Write/Read File
      </a>
    </h1>
    <div class="nested-links f5 lh-copy nested-copy-line-height">
      <p><code>Gob</code> 使用实例，将结构体写入文件里，在需要的时候再从文件中读取出来。</p>
    </div>
  </div>

        </div>
      
        <div class="relative w-100 w-30-l mb4 bg-white">
            <div class="mb3 pa4 mid-gray overflow-hidden">
    
      <div class="f6">
        七月 5, 2014
      </div>
    
    <h1 class="f3 near-black">
      <a href="/post/chroot-shell/" class="link black dim">
        chroot 脚本
      </a>
    </h1>
    <div class="nested-links f5 lh-copy nested-copy-line-height">
      <p>最近测试了以下 <code>chroot</code> ，然后把步骤写成了下面两个脚本，方便以后使用。</p>
<p><strong>使用时需要确定每条命令都执行成功了</strong></p>
<p><code>Arch</code> 分区结构</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-shell" data-lang="shell"><span style="display:flex;"><span>/dev/sda5	/
</span></span><span style="display:flex;"><span>/dev/sda1	/boot
</span></span><span style="display:flex;"><span>/dev/sda6	/home
</span></span><span style="display:flex;"><span>/dev/sda8	Swap
</span></span></code></pre></div>
    </div>
  </div>

        </div>
      
        <div class="relative w-100 w-30-l mb4 bg-white">
            <div class="mb3 pa4 mid-gray overflow-hidden">
    
      <div class="f6">
        七月 4, 2014
      </div>
    
    <h1 class="f3 near-black">
      <a href="/post/build-vpn/" class="link black dim">
        在 VPS 中搭建 VPN 服务器
      </a>
    </h1>
    <div class="nested-links f5 lh-copy nested-copy-line-height">
      <p>最近 <code>Google</code> 被封，而用 <code>Goagent</code> 做代理进行访问的效果而不是很理想，所以就想去买 <code>VPN/VPS</code> . 几经考虑后，就去买了个便宜 <code>VPS</code> , 这样也就可以分享给家人用了。</p>
<p><code>VPS</code> 中安装的是 <code>Ubuntu=，所以搭建 =VPN</code> 服务器也就是在 <code>Ubuntu</code> 上面搭建，具体方法如下。</p>
<p>注意：下面所有的操作都是以 <code>root</code> 用户进行的，非 <code>root</code> 用户请在命令前加上 <code>sudo</code></p>
<p><strong>安装 <code>pptp</code></strong></p>
<p><code>apt-get install pptpd</code></p>
<p>配置 <code>IP</code> 地址范围及服务器 <code>IP</code></p>
<p><code>vi /etc/pptpd.conf</code></p>
<p>取消下面内容的注释</p>
    </div>
  </div>

        </div>
      
        <div class="relative w-100 w-30-l mb4 bg-white">
            <div class="mb3 pa4 mid-gray overflow-hidden">
    
      <div class="f6">
        六月 22, 2014
      </div>
    
    <h1 class="f3 near-black">
      <a href="/post/go-md5-sum/" class="link black dim">
        Go 笔记: md5 sum
      </a>
    </h1>
    <div class="nested-links f5 lh-copy nested-copy-line-height">
      <p>使用 Go 语言实现字符串与文件的 MD5 值计算，但是大文件不要使用此方法。</p>
    </div>
  </div>

        </div>
      
    </aside>
    
    <ul class="pagination pagination-default">
      <li class="page-item">
        <a href="/post/" aria-label="First" class="page-link" role="button"><span aria-hidden="true">&laquo;&laquo;</span></a>
      </li>
      <li class="page-item">
        <a href="/post/page/4/" aria-label="Previous" class="page-link" role="button"><span aria-hidden="true">&laquo;</span></a>
      </li>
      <li class="page-item">
        <a href="/post/page/2/" aria-label="Page 2" class="page-link" role="button">2</a>
      </li>
      <li class="page-item">
        <a href="/post/page/3/" aria-label="Page 3" class="page-link" role="button">3</a>
      </li>
      <li class="page-item">
        <a href="/post/page/4/" aria-label="Page 4" class="page-link" role="button">4</a>
      </li>
      <li class="page-item active">
        <a aria-current="page" aria-label="Page 5" class="page-link" role="button">5</a>
      </li>
      <li class="page-item">
        <a href="/post/page/6/" aria-label="Page 6" class="page-link" role="button">6</a>
      </li>
      <li class="page-item">
        <a href="/post/page/6/" aria-label="Next" class="page-link" role="button"><span aria-hidden="true">&raquo;</span></a>
      </li>
      <li class="page-item">
        <a href="/post/page/6/" aria-label="Last" class="page-link" role="button"><span aria-hidden="true">&raquo;&raquo;</span></a>
      </li>
    </ul>
  </article>

    </main>
    <footer class="bg-black bottom-0 w-100 pa3" role="contentinfo">
  <div class="flex justify-between">
  <a class="f4 fw4 hover-white no-underline white-70 dn dib-ns pv2 ph3" href="https://jouyouyun.github.io" >
    &copy;  jouyouyun 2023 
  </a>
    <div>
<div class="ananke-socials">
  
    <a href="https://github.com/jouyouyun" target="_blank" class="github ananke-social-link link-transition stackoverflow link dib z-999 pt3 pt0-l mr1" title="GitHub link" rel="noopener" aria-label="follow on GitHub——Opens in a new window">
      
        <span class="icon"><svg style="enable-background:new 0 0 512 512;" version="1.1" viewBox="0 0 512 512"  xml:space="preserve" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" >
  <path d="M256,32C132.3,32,32,134.8,32,261.7c0,101.5,64.2,187.5,153.2,217.9c11.2,2.1,15.3-5,15.3-11.1   c0-5.5-0.2-19.9-0.3-39.1c-62.3,13.9-75.5-30.8-75.5-30.8c-10.2-26.5-24.9-33.6-24.9-33.6c-20.3-14.3,1.5-14,1.5-14   c22.5,1.6,34.3,23.7,34.3,23.7c20,35.1,52.4,25,65.2,19.1c2-14.8,7.8-25,14.2-30.7c-49.7-5.8-102-25.5-102-113.5   c0-25.1,8.7-45.6,23-61.6c-2.3-5.8-10-29.2,2.2-60.8c0,0,18.8-6.2,61.6,23.5c17.9-5.1,37-7.6,56.1-7.7c19,0.1,38.2,2.6,56.1,7.7   c42.8-29.7,61.5-23.5,61.5-23.5c12.2,31.6,4.5,55,2.2,60.8c14.3,16.1,23,36.6,23,61.6c0,88.2-52.4,107.6-102.3,113.3   c8,7.1,15.2,21.1,15.2,42.5c0,30.7-0.3,55.5-0.3,63c0,6.1,4,13.3,15.4,11C415.9,449.1,480,363.1,480,261.7   C480,134.8,379.7,32,256,32z"/>
</svg>
</span>
      
<span class="new-window"><svg  height="8px"  style="enable-background:new 0 0 1000 1000;" version="1.1" viewBox="0 0 1000 1000"  xml:space="preserve" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" >
<path d="M598 128h298v298h-86v-152l-418 418-60-60 418-418h-152v-86zM810 810v-298h86v298c0 46-40 86-86 86h-596c-48 0-86-40-86-86v-596c0-46 38-86 86-86h298v86h-298v596h596z" style="fill-rule:evenodd;clip-rule:evenodd;"/>
</svg>
</span></a>
  
</div>
</div>
  </div>
</footer>

  </body>
</html>
